﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DataManager.DAL.SQL
{
    class VasarlasokMsSqlDAO: VasarlasokDAO
    {
        private MsSqlUtils utils;

        public VasarlasokMsSqlDAO(MsSqlUtils utils)
        {
            this.utils = utils;
        }

        public DataSet maxVasarlasokID()
        {
            String sqlCommand = "select max(VasarlasId) from Vasarlasok";

            return utils.FillDataSetFromQuery(sqlCommand);
        }

        public void ujVasarlas(int VasarlasID, int VasarloID, int EladoID, DateTime Datum)
        {
            SqlParameter param0 = new SqlParameter("@pVasarlasId", SqlDbType.Int, 4);
            param0.Value = Convert.ToInt32(VasarlasID);
            SqlParameter param1 = new SqlParameter("@pVasarloId", SqlDbType.Int, 4);
            param1.Value = Convert.ToInt32(VasarloID);
            SqlParameter param2 = new SqlParameter("@pEladoId", SqlDbType.Int, 4);
            param2.Value = Convert.ToInt32(EladoID);
            SqlParameter param3 = new SqlParameter("@pDatum", SqlDbType.DateTime, 4);
            param3.Value = Convert.ToDateTime(Datum);

            utils.ExecuteStoredProcedure("UjVasarlas", param0, param1, param2, param3);
        }
    }
}
